/*
* BurnService.java
* Created on  202015/6/15 17:08
* 版本       修改时间          作者      修改内容
* V1.0.1    202015/6/15       longshihui    初始版本
*
*/

package com.infitecs.eyas.combustion.service;

import com.infitecs.eyas.boiler.dao.AirGasParameterDao;
import com.infitecs.eyas.boiler.dao.EfficiencyDao;
import com.infitecs.eyas.boiler.model.AirGasParameter;
import com.infitecs.eyas.boiler.model.Efficiency;
import com.infitecs.eyas.boiler.service.EfficiencyService;
import com.infitecs.eyas.combustion.dao.BurnDao;
import com.infitecs.eyas.combustion.dao.ChimneyDao;
import com.infitecs.eyas.combustion.dao.CleanDao;
import com.infitecs.eyas.combustion.model.CalculateBurn;
import com.infitecs.eyas.combustion.model.CalculateChimney;
import com.infitecs.eyas.combustion.model.CalculateClean;
import com.infitecs.eyas.constant.Constant;
import com.infitecs.eyas.expression.dao.ExpressionDao;
import com.infitecs.eyas.expression.model.Formula;
import com.infitecs.eyas.expression.service.ExpressionService;
import com.infitecs.eyas.nature.dao.NatureDao;
import com.infitecs.eyas.nature.model.Nature;
import com.infitecs.eyas.power.dao.OperateFieldDao;
import com.infitecs.eyas.power.model.OperateField;
import com.infitecs.eyas.quality.dao.AshDao;
import com.infitecs.eyas.quality.dao.ElementDao;
import com.infitecs.eyas.quality.dao.IndustryDao;
import com.infitecs.eyas.quality.model.Ash;
import com.infitecs.eyas.quality.model.Element;
import com.infitecs.eyas.quality.model.Industry;
import com.infitecs.eyas.session.SessionService;
import com.infitecs.eyas.step.modal.StepInfo;
import com.infitecs.eyas.util.DoubleUtil;
import com.infitecs.krill.ajax.response.AjaxResponse;
import com.infitecs.krill.exception.ValidateErrorException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.Map;

/**
 * 类的描述信息
 *
 * @author longshihui
 * @version 1.0.1
 */
@Service
@Transactional
public class BurnService {
    @Autowired
    private BurnDao burnDao;

    @Autowired
    private SessionService sessionService;
    @Autowired
    private EfficiencyService efficiencyService;
    @Autowired
    private EfficiencyDao efficiencyDao;
    @Autowired
    private AirGasParameterDao airGasParameterDao;
    @Autowired
    private ExpressionService expressionService;
    @Autowired
    private ElementDao elementDao;
    @Autowired
    private NatureDao natureDao;
    @Autowired
    private IndustryDao industryDao;
    @Autowired
    private AshDao ashDao;
    @Autowired
    private OperateFieldDao operateFieldDao;
    @Autowired
    private CleanService cleanService;
    @Autowired
    private CleanDao cleanDao;
    @Autowired
    private ChimneyDao chimneyDao;
    @Autowired
    private ChimneyService chimneyService;

    public void saveValueOfBurn(CalculateBurn calculateBurn) {
        calculateBurn.setCaseId(sessionService.getCaseId());
        burnDao.saveValueOfBurn(calculateBurn);
        calculateBurn.setParamName(sessionService.getE() + calculateBurn.getParamName());
        sessionService.putParamMap(calculateBurn);
    }

    public CalculateBurn getCalculateBurn() {
        return burnDao.getCalculateBurnByCaseId(sessionService.getCaseId());
    }

    public CalculateBurn getCalculateBurn(int caseId) {
        return burnDao.getCalculateBurnByCaseId(caseId);
    }

    public void addCalculateBurn() {
        int caseId = sessionService.getCaseId();
        burnDao.addCalculateBurn(caseId);
        sessionService.addStepState(new StepInfo(caseId, Constant.STEP_ID_6, Constant.STEP_OVER_STATE_0));
    }

    public void saveVo(CalculateBurn calculateBurn) {
        calculateBurn.setCaseId(sessionService.getCaseId());
        burnDao.saveVo(calculateBurn);
    }

    public void burnSave(CalculateBurn calculateBurn) {
        burnSaveDataValidate(calculateBurn);
        burnSaveData(calculateBurn);
        OperateField operateField = operateFieldDao.getOperateField(calculateBurn.getCaseId());

         //更新烟气净化系统
        CalculateClean calculateClean = cleanDao.getCalculateClean(calculateBurn.getCaseId());
        if (calculateClean != null) {
            calculateClean.setE221State(operateField.getE221State());
            calculateClean.setE222State(operateField.getE222State());
            calculateClean.setE231State(operateField.getE231State());
            calculateClean.setE241State(operateField.getE241State());
            calculateClean.setE242State(operateField.getE242State());
            calculateClean.setE248State(operateField.getE248State());
            calculateClean.setE258State(operateField.getE258State());
            cleanService.cleanDataSave(calculateClean);
        }
        //更新烟囱出口直径计算
        CalculateChimney calculateChimney = chimneyDao.getCalculateChimney(calculateBurn.getCaseId());
        if (calculateChimney != null) {
            calculateChimney.setE314State(operateField.getE314State());
            calculateChimney.setE315State(operateField.getE315State());
            calculateChimney.setE316State(operateField.getE316State());
            calculateChimney.setCaseId(operateField.getCaseId());
            chimneyService.chimneySaveData(calculateChimney);
        }
    }

    private void burnSaveDataValidate(CalculateBurn calculateBurn) {
        if (calculateBurn.getYyglState().equals("0")) {
            Efficiency oldEfficiency = efficiencyDao.getEfficiencyByPowerCaseId(calculateBurn.getCaseId());
            if (oldEfficiency == null) {
                throw new ValidateErrorException("锅炉数据未填写或未全部填写，不能引用锅炉数据！");
            }
        }
        if (calculateBurn.getE54State().equals("0")) {
            Efficiency oldEfficiency = efficiencyDao.getEfficiencyByPowerCaseId(calculateBurn.getCaseId());
            if (oldEfficiency == null) {
                throw new ValidateErrorException("锅炉数据未填写或未全部填写，空预器出口烟气需手动填写！");
            }
        }
    }

    public void burnSaveData(CalculateBurn calculateBurn) {
        AirGasParameter airGasParameter = airGasParameterDao.getAirGasParameter(calculateBurn.getCaseId());
        Efficiency efficiency = efficiencyDao.getEfficiencyByPowerCaseId(calculateBurn.getCaseId());
        //获取锅炉参数
        if (calculateBurn.getYyglState().equals("0")) {
            //E3
            calculateBurn.setE3(airGasParameter.getHearthOverOutAirCoefficient());
            //E4
            calculateBurn.setE4(efficiency.getE93());
            //E6
            calculateBurn.setE6(efficiency.getE52());
            //E8
            calculateBurn.setE8(airGasParameter.getE28());
            //20
            calculateBurn.setE20(airGasParameter.getAirPreheaterAirLeakageCoefficient());
        }
        //获取E54烟气温度
        if (calculateBurn.getE54State().equals("0")) {
            AjaxResponse ajaxResponse = efficiencyService.getEfficiencyMedian(calculateBurn.getCaseId());
            calculateBurn.setE54(getValue2(ajaxResponse, "e126"));
        }

        Map<String, Double> dataMap = getBurnData(calculateBurn);
        //获取E88烟气温度
        if (calculateBurn.getE88State().equals("0")) {
            calculateBurn.setE88(dataMap.get("E88"));
        }

        //获取E122烟气温度
        if (calculateBurn.getE122State().equals("0")) {
            calculateBurn.setE122(dataMap.get("E122"));
        }
        //获取E155烟气温度
        if (calculateBurn.getE155State().equals("0")) {
            calculateBurn.setE155(dataMap.get("E155"));
        }
        //获取E171烟气温度
        if (calculateBurn.getE171State().equals("0")) {
            calculateBurn.setE171(dataMap.get("E171"));
        }
        CalculateBurn oldData = burnDao.getCalculateBurnByCaseId(calculateBurn.getCaseId());
        if(oldData==null){
            burnDao.addCalculateBurnData(calculateBurn);
        }else {
            burnDao.saveVo(calculateBurn);
        }

        OperateField operateField = new OperateField();
        operateField.setYyglState(calculateBurn.getYyglState());
        operateField.setE54State(calculateBurn.getE54State());
        operateField.setE88State(calculateBurn.getE88State());
        operateField.setE122State(calculateBurn.getE122State());
        operateField.setE155State(calculateBurn.getE155State());
        operateField.setE171State(calculateBurn.getE171State());
        operateField.setCaseId(calculateBurn.getCaseId());
        operateFieldDao.updateOperateFieldBurn(operateField);
    }

    private double getValue2(AjaxResponse ajaxResponse, String name) {
        return DoubleUtil.getInstance().get3Double((Double) ajaxResponse.getReturnData().get(name));
    }

    public Map<String, Double> getBurnDataByCaseId(int caseId) {
        CalculateBurn calculateBurn = burnDao.getCalculateBurnByCaseId(caseId);
        OperateField operateField =operateFieldDao.getOperateField(caseId);
        calculateBurn.setYyglState(operateField.getYyglState());
        calculateBurn.setE54State(operateField.getE54State());
        calculateBurn.setE88State(operateField.getE88State());
        calculateBurn.setE122State(operateField.getE122State());
        calculateBurn.setE155State(operateField.getE155State());
        calculateBurn.setE171State(operateField.getE171State());
        return  getBurnData(calculateBurn);
    }

    private Map<String, Double> getBurnData(CalculateBurn calculateBurn) {
        Map<String, Formula> formulaMap = expressionService.getFormulaMapByType(6);
        Element element = elementDao.getElementByPowerCaseId(calculateBurn.getCaseId());
        Nature nature = natureDao.getNatureByPowerCaseId(calculateBurn.getCaseId());
        Industry industry = industryDao.getIndustryByPowerCaseId(calculateBurn.getCaseId());
        Ash ash = ashDao.getAshByPowerCaseId(calculateBurn.getCaseId());

        Map<String, Double> paramMap = new HashMap();
        paramMap.put("EPI314", Math.PI);
        paramMap.put("E3", calculateBurn.getE3());
        paramMap.put("E4", calculateBurn.getE4());
        paramMap.put("E6", calculateBurn.getE6());
        paramMap.put("E8", calculateBurn.getE8());
        paramMap.put("E20", calculateBurn.getE20());

        paramMap.put("ME26", element.getCar());
        paramMap.put("ME30", element.getSar());
        //E5
        double e5 = expressionService.getCalculateData(formulaMap.get("RE5"), paramMap);
        paramMap.put("E5", e5);
        paramMap.put("ME27", element.getHar());
        paramMap.put("ME28", element.getOar());
        paramMap.put("ME29", element.getNar());
        //E7
        double e7 = expressionService.getCalculateData(formulaMap.get("RE7"), paramMap);
        paramMap.put("E7", e7);
        paramMap.put("ZE14", nature.getAnnualAverageAirMoisture());
        paramMap.put("ZE6", 101.325);
        paramMap.put("ZE8", 1.285);
        paramMap.put("ZE16", nature.getSummerOutdoorCalculateTemperature());
        paramMap.put("ME3", industry.getMar());
        double e9 = expressionService.getCalculateData(formulaMap.get("RE9"), paramMap);
        paramMap.put("E9", e9);
        //E10
        double E10 = expressionService.getCalculateData(formulaMap.get("RE10"), paramMap);
        paramMap.put("E10", E10);
        //E11
        double E11 = expressionService.getCalculateData(formulaMap.get("RE11"), paramMap);
        paramMap.put("E11", E11);
        //E12
        double E12 = expressionService.getCalculateData(formulaMap.get("RE12"), paramMap);
        paramMap.put("E12", E12);
        //E13
        double E13 = expressionService.getCalculateData(formulaMap.get("RE13"), paramMap);
        paramMap.put("E13", E13);
        //E14
        double E14 = expressionService.getCalculateData(formulaMap.get("RE14"), paramMap);
        paramMap.put("E14", E14);
        //E15
        double E15 = expressionService.getCalculateData(formulaMap.get("RE15"), paramMap);
        paramMap.put("E15", E15);
        //E16
        double E16 = expressionService.getCalculateData(formulaMap.get("RE16"), paramMap);
        paramMap.put("E16", E16);
        //E17
        double E17 = expressionService.getCalculateData(formulaMap.get("RE17"), paramMap);
        paramMap.put("E17", E17);
        //E18
        double E18 = expressionService.getCalculateData(formulaMap.get("RE18"), paramMap);
        paramMap.put("E18", E18);
        //E19
        double E19 = expressionService.getCalculateData(formulaMap.get("RE19"), paramMap);
        paramMap.put("E19", E19);
        //E21
        double E21 = expressionService.getCalculateData(formulaMap.get("RE21"), paramMap);
        paramMap.put("E21", E21);
        //E22
        double E22 = expressionService.getCalculateData(formulaMap.get("RE22"), paramMap);
        paramMap.put("E22", E22);
        //E23
        double E23 = expressionService.getCalculateData(formulaMap.get("RE23"), paramMap);
        paramMap.put("E23", E23);
        //E24
        double E24 = expressionService.getCalculateData(formulaMap.get("RE24"), paramMap);
        paramMap.put("E24", E24);
        //E25
        double E25 = expressionService.getCalculateData(formulaMap.get("RE25"), paramMap);
        paramMap.put("E25", E25);
        //E26
        double E26 = expressionService.getCalculateData(formulaMap.get("RE26"), paramMap);
        paramMap.put("E26", E26);
        //E27
        double E27 = expressionService.getCalculateData(formulaMap.get("RE27"), paramMap);
        paramMap.put("E27", E27);
        //E28
        double E28 = expressionService.getCalculateData(formulaMap.get("RE28"), paramMap);
        paramMap.put("E28", E28);
        //E29
        double E29 = expressionService.getCalculateData(formulaMap.get("RE29"), paramMap);
        paramMap.put("E29", E29);
        //E30
        double E30 = expressionService.getCalculateData(formulaMap.get("RE30"), paramMap);
        paramMap.put("E30", E30);
        //E31
        double E31 = expressionService.getCalculateData(formulaMap.get("RE31"), paramMap);
        paramMap.put("E31", E31);
        //E32
        double E32 = expressionService.getCalculateData(formulaMap.get("RE32"), paramMap);
        paramMap.put("E32", E32);
        //E33
        double E33 = expressionService.getCalculateData(formulaMap.get("RE33"), paramMap);
        paramMap.put("E33", E33);
        //E35
        double E35 = expressionService.getCalculateData(formulaMap.get("RE35"), paramMap);
        paramMap.put("E35", E35);
        paramMap.put("ZE15", nature.getLocalDensityMoistAir());
        //E37
        double E37 = expressionService.getCalculateData(formulaMap.get("RE37"), paramMap);
        paramMap.put("E37", E37);
        paramMap.put("ME6", industry.getAar());
        //e38需要做判断
        double RE38_1 = expressionService.getCalculateData(formulaMap.get("RE38_1"), paramMap);
        double RE38_2 = expressionService.getCalculateData(formulaMap.get("RE38_2"), paramMap);
        double E38 = RE38_1 > RE38_2 ? RE38_1 : RE38_2;
        paramMap.put("E38", E38);
        //E39
        double E39 = expressionService.getCalculateData(formulaMap.get("RE39"), paramMap);
        paramMap.put("E39", E39);
        //E40
        double E40 = expressionService.getCalculateData(formulaMap.get("RE40"), paramMap);
        paramMap.put("E40", E40);
        //E41
        double E41 = expressionService.getCalculateData(formulaMap.get("RE41"), paramMap);
        paramMap.put("E41", E41);
        //E42
        double E42 = expressionService.getCalculateData(formulaMap.get("RE42"), paramMap);
        paramMap.put("E42", E42);
        //E43
        double E43 = expressionService.getCalculateData(formulaMap.get("RE43"), paramMap);
        paramMap.put("E43", E43);
        //E44
        double E44 = expressionService.getCalculateData(formulaMap.get("RE44"), paramMap);
        paramMap.put("E44", E44);
        //E45
        double E45 = expressionService.getCalculateData(formulaMap.get("RE45"), paramMap);
        paramMap.put("E45", E45);
        //E46
        double E46 = expressionService.getCalculateData(formulaMap.get("RE46"), paramMap);
        paramMap.put("E46", E46);
        //E47
        double E47 = expressionService.getCalculateData(formulaMap.get("RE47"), paramMap);
        paramMap.put("E47", E47);
        //E48
        double E48 = expressionService.getCalculateData(formulaMap.get("RE48"), paramMap);
        paramMap.put("E48", E48);
        //E49
        double E49 = expressionService.getCalculateData(formulaMap.get("RE49"), paramMap);
        paramMap.put("E49", E49);
        //E50
        double E50 = expressionService.getCalculateData(formulaMap.get("RE50"), paramMap);
        paramMap.put("E50", E50);
        //E51
        double E51 = expressionService.getCalculateData(formulaMap.get("RE51"), paramMap);
        paramMap.put("E51", E51);
        //E52
        double E52 = expressionService.getCalculateData(formulaMap.get("RE52"), paramMap);
        paramMap.put("E52", E52);
        //E53
        double E53 = expressionService.getCalculateData(formulaMap.get("RE53"), paramMap);
        paramMap.put("E53", E53);
        //E54
        paramMap.put("E54", calculateBurn.getE54());
        //E55
        paramMap.put("E55", calculateBurn.getE55());
        //E56
        paramMap.put("E56", calculateBurn.getE56());
        //E57
        double E57 = expressionService.getCalculateData(formulaMap.get("RE57"), paramMap);
        paramMap.put("E57", E57);
        //E58
        double E58 = expressionService.getCalculateData(formulaMap.get("RE58"), paramMap);
        paramMap.put("E58", E58);
        //E59
        double E59 = expressionService.getCalculateData(formulaMap.get("RE59"), paramMap);
        paramMap.put("E59", E59);
        paramMap.put("ZE5", nature.getLocalPressureOther());

        //E60
        double E60 = expressionService.getCalculateData(formulaMap.get("RE60"), paramMap);
        paramMap.put("E60", E60);
        //E61
        double E61 = expressionService.getCalculateData(formulaMap.get("RE61"), paramMap);
        paramMap.put("E61", E61);
        //E62
        double E62 = expressionService.getCalculateData(formulaMap.get("RE62"), paramMap);
        paramMap.put("E62", E62);
        //E63
        double E63 = expressionService.getCalculateData(formulaMap.get("RE63"), paramMap);
        paramMap.put("E63", E63);
        //E64
        double E64 = expressionService.getCalculateData(formulaMap.get("RE64"), paramMap);
        paramMap.put("E64", E64);
        //E65
        double E65 = expressionService.getCalculateData(formulaMap.get("RE65"), paramMap);
        paramMap.put("E65", E65);
        //E66
        double E66 = expressionService.getCalculateData(formulaMap.get("RE66"), paramMap);
        paramMap.put("E66", E66);
        //E67
        double E67 = expressionService.getCalculateData(formulaMap.get("RE67"), paramMap);
        paramMap.put("E67", E67);
        //E68
        double E68 = expressionService.getCalculateData(formulaMap.get("RE68"), paramMap);
        paramMap.put("E68", E68);
        paramMap.put("E70", calculateBurn.getE70());
        //E71
        double E71 = expressionService.getCalculateData(formulaMap.get("RE71"), paramMap);
        paramMap.put("E71", E71);
        //E72
        double E72 = expressionService.getCalculateData(formulaMap.get("RE72"), paramMap);
        paramMap.put("E72", E72);
        //E73
        double E73 = expressionService.getCalculateData(formulaMap.get("RE73"), paramMap);
        paramMap.put("E73", E73);
        //E74
        double E74 = expressionService.getCalculateData(formulaMap.get("RE74"), paramMap);
        paramMap.put("E74", E74);
        //E75
        double E75 = expressionService.getCalculateData(formulaMap.get("RE75"), paramMap);
        paramMap.put("E75", E75);
        //E76
        double E76 = expressionService.getCalculateData(formulaMap.get("RE76"), paramMap);
        paramMap.put("E76", E76);
        //E77
        double E77 = expressionService.getCalculateData(formulaMap.get("RE77"), paramMap);
        paramMap.put("E77", E77);
        //E78
        double E78 = expressionService.getCalculateData(formulaMap.get("RE78"), paramMap);
        paramMap.put("E78", E78);
        //E79
        double E79 = expressionService.getCalculateData(formulaMap.get("RE79"), paramMap);
        paramMap.put("E79", E79);
        //E80
        double E80 = expressionService.getCalculateData(formulaMap.get("RE80"), paramMap);
        paramMap.put("E80", E80);
        //E81
        double E81 = expressionService.getCalculateData(formulaMap.get("RE81"), paramMap);
        paramMap.put("E81", E81);
        //E82
        double E82 = expressionService.getCalculateData(formulaMap.get("RE82"), paramMap);
        paramMap.put("E82", E82);
        //E83
        double E83 = expressionService.getCalculateData(formulaMap.get("RE83"), paramMap);
        paramMap.put("E83", E83);
        //E84
        double E84 = expressionService.getCalculateData(formulaMap.get("RE84"), paramMap);
        paramMap.put("E84", E84);
        //E85
        double E85 = expressionService.getCalculateData(formulaMap.get("RE85"), paramMap);
        paramMap.put("E85", E85);
        //E86
        double E86 = expressionService.getCalculateData(formulaMap.get("RE86"), paramMap);
        paramMap.put("E86", E86);
        //E87
        double E87 = expressionService.getCalculateData(formulaMap.get("RE87"), paramMap);
        paramMap.put("E87", E87);
        paramMap.put("ZE10", nature.getAnnualAverageTemperature());
        double E88 = calculateBurn.getE88();
        if ("0".equals(calculateBurn.getE88State())) {
            E88 = expressionService.getCalculateData(formulaMap.get("RE88"), paramMap);
        }
        paramMap.put("E88", E88);
        paramMap.put("E89", calculateBurn.getE89());
        //E90
        double E90 = expressionService.getCalculateData(formulaMap.get("RE90"), paramMap);
        paramMap.put("E90", E90);
        //E91
        double E91 = expressionService.getCalculateData(formulaMap.get("RE91"), paramMap);
        paramMap.put("E91", E91);
        //E92
        double E92 = expressionService.getCalculateData(formulaMap.get("RE92"), paramMap);
        paramMap.put("E92", E92);
        //E93
        double E93 = expressionService.getCalculateData(formulaMap.get("RE93"), paramMap);
        paramMap.put("E93", E93);
        //E94
        double E94 = expressionService.getCalculateData(formulaMap.get("RE94"), paramMap);
        paramMap.put("E94", E94);
        //E95
        double E95 = expressionService.getCalculateData(formulaMap.get("RE95"), paramMap);
        paramMap.put("E95", E95);
        //E96
        double E96 = expressionService.getCalculateData(formulaMap.get("RE96"), paramMap);
        paramMap.put("E96", E96);
        //E97
        double E97 = expressionService.getCalculateData(formulaMap.get("RE97"), paramMap);
        paramMap.put("E97", E97);
        //E98
        double E98 = expressionService.getCalculateData(formulaMap.get("RE98"), paramMap);
        paramMap.put("E98", E98);
        //E99
        double E99 = expressionService.getCalculateData(formulaMap.get("RE99"), paramMap);
        paramMap.put("E99", E99);
        //E100
        double E100 = expressionService.getCalculateData(formulaMap.get("RE100"), paramMap);
        paramMap.put("E100", E100);
        //E101
        double E101 = expressionService.getCalculateData(formulaMap.get("RE101"), paramMap);
        paramMap.put("E101", E101);
        paramMap.put("E103", calculateBurn.getE103());
        //E104
        double E104 = expressionService.getCalculateData(formulaMap.get("RE104"), paramMap);
        paramMap.put("E104", E104);
        //E106
        double E106 = expressionService.getCalculateData(formulaMap.get("RE106"), paramMap);
        paramMap.put("E106", E106);
        //E107
        double E107 = expressionService.getCalculateData(formulaMap.get("RE107"), paramMap);
        paramMap.put("E107", E107);
        //E108
        double E108 = expressionService.getCalculateData(formulaMap.get("RE108"), paramMap);
        paramMap.put("E108", E108);
        //E109
        double E109 = expressionService.getCalculateData(formulaMap.get("RE109"), paramMap);
        paramMap.put("E109", E109);
        //E110
        double E110 = expressionService.getCalculateData(formulaMap.get("RE110"), paramMap);
        paramMap.put("E110", E110);
        //E111
        double E111 = expressionService.getCalculateData(formulaMap.get("RE111"), paramMap);
        paramMap.put("E111", E111);
        //E112
        double E112 = expressionService.getCalculateData(formulaMap.get("RE112"), paramMap);
        paramMap.put("E112", E112);
        //E113
        double E113 = expressionService.getCalculateData(formulaMap.get("RE113"), paramMap);
        paramMap.put("E113", E113);
        //E114
        double E114 = expressionService.getCalculateData(formulaMap.get("RE114"), paramMap);
        paramMap.put("E114", E114);
        //E115
        double E115 = expressionService.getCalculateData(formulaMap.get("RE115"), paramMap);
        paramMap.put("E115", E115);
        //E116
        double E116 = expressionService.getCalculateData(formulaMap.get("RE116"), paramMap);
        paramMap.put("E116", E116);
        //E117
        double E117 = expressionService.getCalculateData(formulaMap.get("RE117"), paramMap);
        paramMap.put("E117", E117);
        //E118
        double E118 = expressionService.getCalculateData(formulaMap.get("RE118"), paramMap);
        paramMap.put("E118", E118);
        //E119
        double E119 = expressionService.getCalculateData(formulaMap.get("RE119"), paramMap);
        paramMap.put("E119", E119);
        //E120
        double E120 = expressionService.getCalculateData(formulaMap.get("RE120"), paramMap);
        paramMap.put("E120", E120);
        //E121
        double E121 = expressionService.getCalculateData(formulaMap.get("RE121"), paramMap);
        paramMap.put("E121", E121);
        double E122 = calculateBurn.getE122();
        if ("0".equals(calculateBurn.getE122State())) {
            E122 = expressionService.getCalculateData(formulaMap.get("RE122"), paramMap);
        }
        paramMap.put("E122", E122);
        paramMap.put("E123", calculateBurn.getE123());
        //E124
        double E124 = expressionService.getCalculateData(formulaMap.get("RE124"), paramMap);
        paramMap.put("E124", E124);
        //E125
        double E125 = expressionService.getCalculateData(formulaMap.get("RE125"), paramMap);
        paramMap.put("E125", E125);
        //E124
        double E126 = expressionService.getCalculateData(formulaMap.get("RE126"), paramMap);
        paramMap.put("E126", E126);
        //E127
        double E127 = expressionService.getCalculateData(formulaMap.get("RE127"), paramMap);
        paramMap.put("E127", E127);
        //E128
        double E128 = expressionService.getCalculateData(formulaMap.get("RE128"), paramMap);
        paramMap.put("E128", E128);
        //E129
        double E129 = expressionService.getCalculateData(formulaMap.get("RE129"), paramMap);
        paramMap.put("E129", E129);
        //E130
        double E130 = expressionService.getCalculateData(formulaMap.get("RE130"), paramMap);
        paramMap.put("E130", E130);
        //E131
        double E131 = expressionService.getCalculateData(formulaMap.get("RE131"), paramMap);
        paramMap.put("E131", E131);
        //E132
        double E132 = expressionService.getCalculateData(formulaMap.get("RE132"), paramMap);
        paramMap.put("E132", E132);
        //E133
        double E133 = expressionService.getCalculateData(formulaMap.get("RE133"), paramMap);
        paramMap.put("E133", E133);
        //E134
        double E134 = expressionService.getCalculateData(formulaMap.get("RE134"), paramMap);
        paramMap.put("E134", E134);
        //E135
        double E135 = expressionService.getCalculateData(formulaMap.get("RE135"), paramMap);
        paramMap.put("E135", E135);

        paramMap.put("E137", calculateBurn.getE137());
        //E138
        double E138 = expressionService.getCalculateData(formulaMap.get("RE138"), paramMap);
        paramMap.put("E138", E138);
        //E139
        double E139 = expressionService.getCalculateData(formulaMap.get("RE139"), paramMap);
        paramMap.put("E139", E139);
        //E140
        double E140 = expressionService.getCalculateData(formulaMap.get("RE140"), paramMap);
        paramMap.put("E140", E140);
        //E141
        double E141 = expressionService.getCalculateData(formulaMap.get("RE141"), paramMap);
        paramMap.put("E141", E141);
        //E142
        double E142 = expressionService.getCalculateData(formulaMap.get("RE142"), paramMap);
        paramMap.put("E142", E142);
        //E143
        double E143 = expressionService.getCalculateData(formulaMap.get("RE143"), paramMap);
        paramMap.put("E143", E143);
        //E144
        double E144 = expressionService.getCalculateData(formulaMap.get("RE144"), paramMap);
        paramMap.put("E144", E144);
        //E145
        double E145 = expressionService.getCalculateData(formulaMap.get("RE145"), paramMap);
        paramMap.put("E145", E145);
        //E146
        double E146 = expressionService.getCalculateData(formulaMap.get("RE146"), paramMap);
        paramMap.put("E146", E146);
        //E147
        double E147 = expressionService.getCalculateData(formulaMap.get("RE147"), paramMap);
        paramMap.put("E147", E147);
        //E148
        double E148 = expressionService.getCalculateData(formulaMap.get("RE148"), paramMap);
        paramMap.put("E148", E148);
        //E149
        double E149 = expressionService.getCalculateData(formulaMap.get("RE149"), paramMap);
        paramMap.put("E149", E149);
        //E150
        double E150 = expressionService.getCalculateData(formulaMap.get("RE150"), paramMap);
        paramMap.put("E150", E150);
        //E151
        double E151 = expressionService.getCalculateData(formulaMap.get("RE151"), paramMap);
        paramMap.put("E151", E151);
        //E152
        double E152 = expressionService.getCalculateData(formulaMap.get("RE152"), paramMap);
        paramMap.put("E152", E152);
        //E153
        double E153 = expressionService.getCalculateData(formulaMap.get("RE153"), paramMap);
        paramMap.put("E153", E153);
        //E154
        double E154 = expressionService.getCalculateData(formulaMap.get("RE154"), paramMap);
        paramMap.put("E154", E154);
        //E155
        double E155 = calculateBurn.getE155();
        if ("0".equals(calculateBurn.getE155State())) {
            E155 = expressionService.getCalculateData(formulaMap.get("RE155"), paramMap);
        }
        paramMap.put("E155", E155);
        paramMap.put("E156", calculateBurn.getE156());
        //E157
        double E157 = expressionService.getCalculateData(formulaMap.get("RE157"), paramMap);
        paramMap.put("E157", E157);
        //E158
        double E158 = expressionService.getCalculateData(formulaMap.get("RE158"), paramMap);
        paramMap.put("E158", E158);
        //E159
        double E159 = expressionService.getCalculateData(formulaMap.get("RE159"), paramMap);
        paramMap.put("E159", E159);
        //E160
        double E160 = expressionService.getCalculateData(formulaMap.get("RE160"), paramMap);
        paramMap.put("E160", E160);
        //E161
        double E161 = expressionService.getCalculateData(formulaMap.get("RE161"), paramMap);
        paramMap.put("E161", E161);
        //E162
        double E162 = expressionService.getCalculateData(formulaMap.get("RE162"), paramMap);
        paramMap.put("E162", E162);
        //E163
        double E163 = expressionService.getCalculateData(formulaMap.get("RE163"), paramMap);
        paramMap.put("E163", E163);
        //E164
        double E164 = expressionService.getCalculateData(formulaMap.get("RE164"), paramMap);
        paramMap.put("E164", E164);
        //E165
        double E165 = expressionService.getCalculateData(formulaMap.get("RE165"), paramMap);
        paramMap.put("E165", E165);
        //E166
        double E166 = expressionService.getCalculateData(formulaMap.get("RE166"), paramMap);
        paramMap.put("E166", E166);
        //E167
        double E167 = expressionService.getCalculateData(formulaMap.get("RE167"), paramMap);
        paramMap.put("E167", E167);
        //E168
        double E168 = expressionService.getCalculateData(formulaMap.get("RE168"), paramMap);
        paramMap.put("E168", E168);
        //E170
        paramMap.put("E170", calculateBurn.getE170());
        //171 TODO 暂时获取手填写
        double E171 = calculateBurn.getE171();
        if ("0".equals(calculateBurn.getE171State())) {
            E171 = calculateBurn.getE170() + E155;
        }
        paramMap.put("E171", E171);
        //E172
        double E172 = expressionService.getCalculateData(formulaMap.get("RE172"), paramMap);
        paramMap.put("E172", E172);
        //E173
        double E173 = expressionService.getCalculateData(formulaMap.get("RE173"), paramMap);
        paramMap.put("E173", E173);
        //E174
        double E174 = expressionService.getCalculateData(formulaMap.get("RE174"), paramMap);
        paramMap.put("E174", E174);
        //E175
        double E175 = expressionService.getCalculateData(formulaMap.get("RE175"), paramMap);
        paramMap.put("E175", E175);
        //E176
        double E176 = expressionService.getCalculateData(formulaMap.get("RE176"), paramMap);
        paramMap.put("E176", E176);
        //E177
        double E177 = expressionService.getCalculateData(formulaMap.get("RE177"), paramMap);
        paramMap.put("E177", E177);
        //E178
        double E178 = expressionService.getCalculateData(formulaMap.get("RE178"), paramMap);
        paramMap.put("E178", E178);
        //E179
        double E179 = expressionService.getCalculateData(formulaMap.get("RE179"), paramMap);
        paramMap.put("E179", E179);
        //E180
        double E180 = expressionService.getCalculateData(formulaMap.get("RE180"), paramMap);
        paramMap.put("E180", E180);
        //E181
        double E181 = expressionService.getCalculateData(formulaMap.get("RE181"), paramMap);
        paramMap.put("E181", E181);
        //E182
//        double E182 = expressionService.getCalculateData(formulaMap.get("RE182"), paramMap);
//        paramMap.put("E182", E182);
        //E183
//        double E183 = expressionService.getCalculateData(formulaMap.get("RE183"), paramMap);
//        paramMap.put("E183", E183);
        paramMap.put("ME13", element.getQnetAr());
        paramMap.put("ME35", ash.getFe2o3());
        paramMap.put("ME36", ash.getCao());
        paramMap.put("ME38", ash.getMgo());
        paramMap.put("ME40", ash.getK2o());
        paramMap.put("ME41", ash.getNa2o());
        paramMap.put("ZE4", nature.getLocalPressure());
        //E184
        double E184 = expressionService.getCalculateData(formulaMap.get("RE184"), paramMap);
        paramMap.put("E184", E184);
        //E185
        double E185 = expressionService.getCalculateData(formulaMap.get("RE185"), paramMap);
        paramMap.put("E185", E185);
        //E186
        double E186 = expressionService.getCalculateData(formulaMap.get("RE186"), paramMap);
        paramMap.put("E186", E186);
        //E187
        double E187 = expressionService.getCalculateData(formulaMap.get("RE187"), paramMap);
        paramMap.put("E187", E187);
        //E188
        double E188 = expressionService.getCalculateData(formulaMap.get("RE188"), paramMap);
        paramMap.put("E188", E188);
        //E189
        double E189 = expressionService.getCalculateData(formulaMap.get("RE189"), paramMap);
        paramMap.put("E189", E189);
        double ME30 =element.getSar();
        paramMap.put("ET1192",  (ME30 <= 1) ? 0.15 : (ME30 > 1 || ME30 <= 2) ? 0.11 : 0.137);
        //E192 todo暂时等于1
        paramMap.put("E191", 1.0);
        //E192
        double E192 = expressionService.getCalculateData(formulaMap.get("RE192"), paramMap);
        paramMap.put("E192", E192);
        //E193
        double E193 = expressionService.getCalculateData(formulaMap.get("RE193"), paramMap);
        paramMap.put("E193", E193);
        //E194
        double E194 = expressionService.getCalculateData6(formulaMap.get("RE194"), paramMap);
        paramMap.put("E194", E194);
        //E195
        double E195 = expressionService.getCalculateData6(formulaMap.get("RE195"), paramMap);
        paramMap.put("E195", E195);
        //E196
        double E196 = expressionService.getCalculateData6(formulaMap.get("RE196"), paramMap);
        paramMap.put("E196", E196);
        //E197
        double E197 = expressionService.getCalculateData6(formulaMap.get("RE197"), paramMap);
        paramMap.put("E197", E197);
        //E198
        double E198 = expressionService.getCalculateData6(formulaMap.get("RE198"), paramMap);
        paramMap.put("E198", E198);
        //E199
        double E199 = expressionService.getCalculateData6(formulaMap.get("RE199"), paramMap);
        paramMap.put("E199", E199);
        //E200
        double E200 = expressionService.getCalculateData6(formulaMap.get("RE200"), paramMap);
        paramMap.put("E200", E200);
        //E201
        double E201 = expressionService.getCalculateData6(formulaMap.get("RE201"), paramMap);
        paramMap.put("E201", E201);
        //E202
        double E202 = expressionService.getCalculateData6(formulaMap.get("RE202"), paramMap);
        paramMap.put("E202", E202);
        //E203
        double E203 = expressionService.getCalculateData6(formulaMap.get("RE203"), paramMap);
        paramMap.put("E203", E203);
        //E204
        double E204 = expressionService.getCalculateData6(formulaMap.get("RE204"), paramMap);
        paramMap.put("E204", E204);
        //E205
        double E205 = expressionService.getCalculateData6(formulaMap.get("RE205"), paramMap);
        paramMap.put("E205", E205);
        //E206
        double E206 = expressionService.getCalculateData6(formulaMap.get("RE206"), paramMap);
        paramMap.put("E206", E206);
        //E207
        double E207 = expressionService.getCalculateData6(formulaMap.get("RE207"), paramMap);
        paramMap.put("E207", E207);
        //E208
        double E208 = expressionService.getCalculateData6(formulaMap.get("RE208"), paramMap);
        paramMap.put("E208", E208);
        //E210
        double E210 = expressionService.getCalculateData(formulaMap.get("RE210"), paramMap);
        paramMap.put("E210", E210);
        //E211
        double E211 = expressionService.getCalculateData(formulaMap.get("RE211"), paramMap);
        paramMap.put("E211", E211);
        //E212
        double E212 = expressionService.getCalculateData(formulaMap.get("RE212"), paramMap);
        paramMap.put("E212", E212);
        //E213
        double E213 = expressionService.getCalculateData(formulaMap.get("RE213"), paramMap);
        paramMap.put("E213", E213);
        //E214
        double E214 = expressionService.getCalculateData(formulaMap.get("RE214"), paramMap);
        paramMap.put("E214", E214);
        //E215
        double E215 = expressionService.getCalculateData(formulaMap.get("RE215"), paramMap);
        paramMap.put("E215", E215);
        //E210
        double E216 = expressionService.getCalculateData(formulaMap.get("RE216"), paramMap);
        paramMap.put("E216", E216);
        //E218
        double E218 = expressionService.getCalculateData(formulaMap.get("RE218"), paramMap);
        paramMap.put("E218", E218);
        //E221
        double E221 = expressionService.getCalculateData(formulaMap.get("RE221"), paramMap);
        paramMap.put("E221", E221);
        //E222
        double E222 = expressionService.getCalculateData(formulaMap.get("RE222"), paramMap);
        paramMap.put("E222", E222);
        //E330
        double E330 = expressionService.getCalculateData(formulaMap.get("RE330"), paramMap);
        paramMap.put("E330", E330);
        return paramMap;
    }

}
